package com.wendy.util;

import java.math.BigDecimal;
import java.text.DecimalFormat;

/**
 * Description:
 * date: 2022/2/23 11:10
 *
 * @author Wendy
 * @since JDK 1.8
 */
public class TestClass {

  public static void main(String[] args) {

    double double1 = 0.003*24*60*60*1000;
    double double2 = Double.parseDouble("0.003")*86400000;

    System.out.println("double1 --> " + double1);
    System.out.println("double2 --> " + double2);

    BigDecimal bigDecimal = BigDecimal.valueOf(0.003);
    BigDecimal multiply = bigDecimal.multiply(BigDecimal.valueOf(24))
            .multiply(BigDecimal.valueOf(60))
            .multiply(BigDecimal.valueOf(60))
            .multiply(BigDecimal.valueOf(1000));

    System.out.println("bigDecimal --> " + multiply);

    long timeMillis = System.currentTimeMillis();
    System.out.println("timeMillis --> " + timeMillis);
    System.out.println("round(double2) --> " + Math.round(double2));

    System.out.println(timeMillis + Math.round(double2));

    System.out.println("scienceToLong  -->  " + scienceToLong("1.645587447012E12"));
  }

  public static Number scienceToLong(String angle){
    try {
      DecimalFormat format = new DecimalFormat();
      return format.parse(angle);
    }catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
}
